package dummy.virussim

import mars.ns.core._
import mars.ns.EventSimulation
import mars.ns.visualisation._

object EventSim extends Application{
    val net:Network[Person] =  new Network[Person]()
	for(i<-0 until 10){
        net.addNode(new Person)
    }
    // connect everyone in a circle
    var prev : Person = net.getNodes.last
    net.getNodes.foreach {node => {node.addDoubleLink(prev); prev = node} }
    val nodes = net.getNodes()
    var events:List[InfectEvent[Person]] = List(new InfectEvent[Person](net,nodes.apply(7)))
    for(i<-0 until 3) {
        net.addNode(new Person) // uninfectable person, without friends :o
        events = new InfectEvent[Person](net,net.getNodes.apply(i))::events
    }
    
    
    //make 2 people immune
    nodes.apply(2).setImmune
    nodes.apply(6).setImmune
    
    
    var sim:EventSimulation[Person] = new EventSimulation[Person](net,events.size, events)
	sim.subscribe(new VirusVisualisation[Person](net))
	sim.run
    
}